﻿// BarChart.js
import React from 'react';
import Echarts from 'echarts-for-react';

const Line = ({ data, title }) => {
    const colors = ['#5793f3', '#d14a61', '#675bba', '#e8684a', '#2fc25b', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'];
    const option = {
        title: {
            text: '人数变化折线图',
            left: 'lefttop',
        },
        tooltip: {
            
        },
        xAxis: {
            type: 'category',
            data: Object.keys(data[0]),
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                // name: '数值',
                type: 'line',
                data: Object.values(data[0]),
                
                animation: true,
                animationDurationUpdate: 50,
                animationEasingUpdate: 'cubicOut'
            },
            {
                // name: '数值',
                type: 'line',
                data: Object.values(data[1]),
                
                animation: true,
                animationDurationUpdate: 50,
                animationEasingUpdate: 'cubicOut'
            }],
    };

    return (
        <div>
            <Echarts
                option={option}
                style={{ height: '400px', width: '100%' }}
                lazyUpdate={true}
            />
        </div>
    );
};

export default Line;